#ifndef PARSEPMT_H_
#define PARSEPMT_H_

#define PMT_DESCRIPTOR_MAX 1024

#define PMT_VUDIO_COUNT 20

#define PMT_STREAM_MAX 32

typedef struct TS_PMT_Stream
{
    unsigned stream_type        :8;
    unsigned reserved_5         :3;
    unsigned elementary_PID     :13;
    unsigned reserved_6         :4;
    unsigned ES_info_length     :12;

    unsigned char descriptor[PMT_DESCRIPTOR_MAX];    

}TS_PMT_Stream;

typedef struct TS_PMT
{
    unsigned  table_id                  :8;
	unsigned  section_syntax_indicator  :1;
	unsigned  zero                      :1;
	unsigned  reserved_1                :2;
	unsigned  section_length            :12;
	unsigned  program_number            :16;
	unsigned  reserved_2                :2;
	unsigned  version_number            :5;
	unsigned  current_next_indicator    :1;
	unsigned  section_number            :8;
	unsigned  last_section_number       :8;
	unsigned  reserved_3                :3;
	unsigned  PCR_PID                   :13;
	unsigned  reserved_4                :4;
	unsigned  program_info_length       :12;

	unsigned char program_info_descriptor[PMT_DESCRIPTOR_MAX];

	TS_PMT_Stream astPMT_Stream[PMT_STREAM_MAX];

	unsigned  CRC_32                    :32;      

	struct TS_PMT *next; 
	struct TS_PMT *Previous;
}TS_PMT;

typedef struct PMT_INFO
{
	unsigned ProgramNumber :16;
	unsigned VideoPID :13;
	unsigned AudioPID[PMT_VUDIO_COUNT];
}PMT_INFO;


TS_PMT *TS_PackagePmtPoint;
TS_PMT *PmtPoint;
#endif